package functest;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;

import functest.FindAPrint;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

public class getjc extends HttpServlet {


	private static final long serialVersionUID = 1L;


	public getjc() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}


	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		String cityname=request.getParameter("cityname");
		FindAPrint test=new FindAPrint();
		PrintWriter out=response.getWriter();
		System.out.println("测试数据："+cityname+"\n");
		try {
			List<String> jclist=test.Findjcs(cityname);
			System.out.print(cityname+" " +jclist);
			String list="";
			for(int i=0;i<jclist.size();i++)
			{
				list+=jclist.get(i);
				if(i<jclist.size()-1) list+=",";
			}

			out.print(list);
		} catch (SQLException e) {
			//	 TODO Auto-generated catch block
			e.printStackTrace();
		}


	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
